namespace OFX.Aggregator.Infrastructure
{
	#region #using Directives

	using System;
	using System.Collections;

	#endregion

	public interface IIocContainerAbstraction
	{
		void AddComponentInstance<T>(Type serviceType, object instance);
		void ReleaseComponent(object instance);

		object Resolve(Type service, string key, IDictionary parameters);
	}

	public static class IocContainerAbstractionExtensionMethods
	{
		public static T Resolve<T>(this IIocContainerAbstraction container)
		{
			return (T) container.Resolve(typeof(T), null, null);
		}

		public static T Resolve<T>(this IIocContainerAbstraction container, IDictionary parameters)
		{
			return (T) container.Resolve(typeof(T), null, parameters);
		}

		public static T Resolve<T>(this IIocContainerAbstraction container, string key)
		{
			return (T) container.Resolve(typeof(T), key, null);
		}

		public static T Resolve<T>(this IIocContainerAbstraction container, string key, IDictionary parameters)
		{
			return (T) container.Resolve(typeof(T), key, parameters);
		}
	}
}